﻿Jxstar.currentPage = function() {
	var config = {param:{},initpage:function(page, define){},eventcfg:{}};

	var auditData = Jxstar.findComboData('audit');
	var resulttypeData = Jxstar.findComboData('resulttype');
	var quality_typeData = Jxstar.findComboData('quality_type');

	var cols = [
	{col:{header:'记录状态', width:73, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: auditData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: auditData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < auditData.length; i++) {
				if (auditData[i][0] == value)
					return auditData[i][1];
			}
		}}, field:{name:'quality_check__auditing1',type:'string'}},
	{col:{header:'质量检查编号', width:100, sortable:true}, field:{name:'quality_check__plan_no',type:'string'}},
	{col:{header:'项目编号', width:100, sortable:true}, field:{name:'quality_check__project_code',type:'string'}},
	{col:{header:'项目名称', width:194, sortable:true}, field:{name:'quality_check__project_name',type:'string'}},
	{col:{header:'计划检测日期', width:84, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'quality_check__plan_date',type:'date'}},
	{col:{header:'任务序号', width:68, sortable:true, hidden:true, renderer:JxUtil.formatInt()}, field:{name:'quality_check__task_no',type:'int'}},
	{col:{header:'任务名称', width:192, sortable:true, hidden:true}, field:{name:'quality_check__task_name',type:'string'}},
	{col:{header:'记录日期', width:100, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'quality_check__record_date',type:'date'}},
	{col:{header:'记录人', width:81, sortable:true}, field:{name:'quality_check__record_user',type:'string'}},
	{col:{header:'实施部门', width:100, sortable:true, hidden:true}, field:{name:'quality_check__dept_name',type:'string'}},
	{col:{header:'检测内容', width:237, sortable:true}, field:{name:'quality_check__check_content',type:'string'}},
	{col:{header:'检测结果', width:83, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: resulttypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false, allowBlank:false,
			value: resulttypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < resulttypeData.length; i++) {
				if (resulttypeData[i][0] == value)
					return resulttypeData[i][1];
			}
		}}, field:{name:'quality_check__record_result',type:'string'}},
	{col:{header:'检测人', width:100, sortable:true, hidden:true}, field:{name:'quality_check__check_user',type:'string'}},
	{col:{header:'项目负责人', width:100, sortable:true, hidden:true}, field:{name:'quality_check__project_user',type:'string'}},
	{col:{header:'重要性', width:100, sortable:true, hidden:true}, field:{name:'quality_check__importance',type:'string'}},
	{col:{header:'检查类别', width:100, sortable:true, hidden:true}, field:{name:'quality_check__check_type',type:'string'}},
	{col:{header:'检查等级', width:100, sortable:true, hidden:true}, field:{name:'quality_check__check_level',type:'string'}},
	{col:{header:'权重', width:100, sortable:true, hidden:true}, field:{name:'quality_check__weight',type:'string'}},
	{col:{header:'计划状态', width:100, sortable:true, hidden:true, align:'center',
		renderer:function(value){
			for (var i = 0; i < auditData.length; i++) {
				if (auditData[i][0] == value)
					return auditData[i][1];
			}
		}}, field:{name:'quality_check__check_status',type:'string'}},
	{col:{header:'检查工期', width:100, sortable:true, hidden:true}, field:{name:'quality_check__check_period',type:'string'}},
	{col:{header:'最早开工日期', width:100, sortable:true, hidden:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'quality_check__start_date',type:'date'}},
	{col:{header:'最早结束日期', width:100, sortable:true, hidden:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'quality_check__end_date',type:'date'}},
	{col:{header:'备注', width:100, sortable:true, hidden:true}, field:{name:'quality_check__comments',type:'string'}},
	{col:{header:'项目ID', width:100, sortable:true, hidden:true}, field:{name:'quality_check__project_id',type:'string'}},
	{col:{header:'主键', width:100, sortable:true, hidden:true}, field:{name:'quality_check__check_id',type:'string'}},
	{col:{header:'部门ID', width:100, sortable:true, hidden:true}, field:{name:'quality_check__dept_id',type:'string'}},
	{col:{header:'项目负责人ID', width:100, sortable:true, hidden:true}, field:{name:'quality_check__project_userid',type:'string'}},
	{col:{header:'检测结果说明', width:176, sortable:true}, field:{name:'quality_check__record_memo',type:'string'}},
	{col:{header:'记录人ID', width:100, sortable:true, hidden:true}, field:{name:'quality_check__record_userid',type:'string'}},
	{col:{header:'检测人id', width:100, sortable:true, hidden:true}, field:{name:'quality_check__check_userid',type:'string'}},
	{col:{header:'检查类型', width:100, sortable:true, hidden:true, align:'center',
		renderer:function(value){
			for (var i = 0; i < quality_typeData.length; i++) {
				if (quality_typeData[i][0] == value)
					return quality_typeData[i][1];
			}
		}}, field:{name:'quality_check__check_type1',type:'string'}},
	{col:{header:'整改编号', width:100, sortable:true}, field:{name:'quality_check__quest_code',type:'string'}}
	];
	
	config.param = {
		cols: cols,
		sorts: null,
		hasQuery: '1',
		isedit: '0',
		isshow: '1',
		funid: 'quality_checkreg'
	};
	
	config.eventcfg = {								//质量检测登记和安全检查登记 的前台方法		addQuest: function(){			var records = this.grid.getSelectionModel().getSelections();			if (!JxUtil.selected(records)) return;						var checkids = '';			for (var i = 0; i < records.length; i++) {				var checkid = records[i].get('quality_check__check_id');				checkids += '&keyid=' + checkid ;			}						var params = 'funid=quality_checkreg' + checkids; 			params += '&pagetype=grid&eventcode=addQuest';						var self = this;			var endcall = function(data) {				//重新加载数据				self.grid.getStore().reload();			};			//发送请求			Request.postRequest(params, endcall);		}
	};
		
	return new Jxstar.GridNode(config);
}